package com.springboot.springboot04aop.component;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;


@Component
@Aspect
public class Aspectaop {

    private static final  Logger logger = LoggerFactory.getLogger(Aspectaop.class);
    @Pointcut("execution(* com.springboot.springboot04aop.service..*.*(..))")
    public void Methods(){

    }

    @Before("Methods()")
    public void before(JoinPoint joinPoint){
        String methodname = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();
        logger.info("方法开始执行：{}，参数：{}",methodname,args);

    }
}
